@extends('client/layoutIndex')

@section('link')
    <link rel="stylesheet" href="{{ asset('client/css/huiyuan.css') }}">

    <script>
        // --账户设置--
        window.onload = function(){
            var jbsz=document.getElementById("jbsz");
            var xgmm=document.getElementById("xgmm");
            var dzgl=document.getElementById("dzgl");
            var mp=document.getElementById("mp");
        }

        function jbsz1(){
            jbsz.style.display="block";
            xgmm.style.display="none";
            dzgl.style.display="none";
            mp.style.display="none";
        }
        function xgmm1(){

            jbsz.style.display="none";
            xgmm.style.display="block";
            dzgl.style.display="none";
            mp.style.display="none";
        }
        function dzgl1(){

            jbsz.style.display="none";
            xgmm.style.display="none";
            dzgl.style.display="block";
            mp.style.display="none";
        }
        function mp1(){
            jbsz.style.display="none";
            xgmm.style.display="none";
            dzgl.style.display="none";
            mp.style.display="block";
        }
    </script>
@stop

@section('content')
        <div style="width:100%;">
            <div class="dgg">
                <h1 style="font-weight:bold;">会员中心</h1>
                MEMBER&nbsp;CENTER
            </div>
        </div>
    <!-- --大广告 end-- -->
    <!-- --账户设置-- -->
    <div class="shezhi">
        <center>
            <div class="shezhi-zhong">
                <div class="shezhi-zhong-left">
                    <div class="tit">
                        <h3 style="font-weight:bold;">账户设置</h3>
                        <span></span>
                        <img src="{{ asset("client/image/xvxian.png") }}">
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                    </div>
                    <div class="sz">
                        <div class="sz-left">
                            <ul>
                                <li>

                                    <a href="javascript:"  onclick="jbsz1()">
                                        <span class="glyphicon glyphicon-cog"></span>
                                        <span>基本设置&nbsp;&nbsp;&nbsp;&nbsp;></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:" onclick="xgmm1()">
                                        <span class="glyphicon glyphicon-wrench"></span>
                                        <span>修改密码&nbsp;&nbsp;&nbsp;&nbsp;></span>
                                    </a>
                                </li>
                                {{--<li>--}}
                                    {{--<a href="javascript:" onclick="dzgl1()">--}}
                                        {{--<span class="glyphicon glyphicon-map-marker"></span>--}}
                                        {{--<span>地址管理&nbsp;&nbsp;&nbsp;&nbsp;></span>--}}
                                    {{--</a>--}}
                                {{--</li>--}}
                                {{--<li>--}}
                                    {{--<a href="javascript:" onclick="mp1()">--}}
                                        {{--<span class="glyphicon glyphicon-user"></span>--}}
                                        {{--<span>修改头像&nbsp;&nbsp;&nbsp;&nbsp;></span>--}}
                                        {{--<!-- <span class="glyphicon glyphicon-user"><span>--}}
                                        {{--<span>修改头像&nbsp;&nbsp;></span> -->--}}
                                    {{--</a>--}}
                                {{--</li>--}}
                            </ul>
                        </div>

                        <div class="sz-right">
                            <!-- --基本设置-- -->
                            <div class="jbsz" id="jbsz">
                                <form class="form-horizontal" action="{{ url('client/user/updateUser') }}" method="post">
                                    {{csrf_field()}}
                                    <input type="hidden" name="id" value="{{ $data['id'] }}">
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">昵称:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="text" class="form-control" placeholder="昵称" name="username" value="{{ $data['username'] }}">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">姓名:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="text" class="form-control" placeholder="请输入姓名" name="name" value="{{ $data['name'] }}">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">性别:</label>
                                        <div class="col-md-3 col-sm-8 col-xs-8">
                                            @if($data['sex'] === '0')
                                                <input type="radio" name="sex" value="0" checked="checked">男
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="sex" value="1">女
                                            @elseif($data['sex'] === '1')
                                                <input type="radio" name="sex" value="0" >男
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="sex" value="1" checked="checked">女
                                            @else
                                                <input type="radio" name="sex" value="0" >男
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" name="sex" value="1" >女
                                            @endif
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">出生日期</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input class="form-control laydate-icon" placeholder="请输入日期" name="birth" onClick="laydate({istime: true, format: 'YYYY-MM-DD'})" style="height:34px;" value="{{ $data['birth'] }}">
                                        </div>
                                    </div>

                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">邮箱:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="email" class="form-control" placeholder="请输入邮箱" name="email" value="{{ $data['email'] }}">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">手机:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="text" class="form-control" placeholder="请输入手机号码" name="phone" value="{{ $data['phone'] }}">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">身份证号:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="text" class="form-control" placeholder="请输入身份证号" name="user_num" value="{{ $data['user_num'] }}">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">车牌号:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="text" class="form-control" placeholder="请输入车牌号" name="car_num" value="{{ $data['car_num'] }}">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">收货地址：</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <textarea rows="2" style="width:100%;" name="address" placeholder="请如实填写详细收货地址">{{ $data['address'] }}</textarea>
                                        </div>
                                    </div>
                                    <input type="submit" value="提交修改" class="btn btn-warning btn-md" style="font-weight:bold;">
                                </form>
                            </div>
                            <!-- --修改密码-- -->
                            <div class="xgmm" id="xgmm">
                                <form class="form-horizontal" action="{{ url('client/user/changePass') }}" method="post">
                                    {{csrf_field()}}
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">当前密码:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="password" class="form-control" placeholder="请输入当前密码" name="password1">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">设置新密码:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="password" class="form-control" placeholder="请输入新密码" name="password2">
                                        </div>
                                    </div>
                                    <div class="form-group" style="margin:30px;">
                                        <label class="col-md-3 col-sm-3 col-xs-3 control">确认新密码:</label>
                                        <div class="col-md-8 col-sm-8 col-xs-8">
                                            <input type="password" class="form-control" placeholder="请再次输入新密码" name="password3">
                                        </div>
                                    </div>
                                    <input type="submit" name="sub" class="btn btn-warning btn-md" value="提&nbsp;&nbsp;交" style="font-weight:bold;width:120px;font-size:18px;">
                                </form>
                            </div>
                            {{--<!-- --地址管理-- -->--}}
                            {{--<div class="dzgl" id="dzgl">--}}
                                {{--<form class="form-horizontal" action="{{ url('client/toAddress') }}" method="post">--}}
                                    {{--{{csrf_field()}}--}}
                                    {{--<div class="form-group" style="margin:30px;">--}}
                                        {{--<label class="col-md-3 col-sm-3 col-xs-3 control">收货地址：</label>--}}
                                        {{--<div class="col-md-8 col-sm-8 col-xs-8">--}}
                                            {{--<textarea rows="2" style="width:100%;" name="get_addre" placeholder="请如实填写详细收货地址">{{ $data['address'] }}</textarea>--}}
                                        {{--</div>--}}
                                    {{--</div>--}}
                                    {{--<input type="submit" value="保&nbsp;&nbsp;存" class="btn btn-danger" style="width:120px;font-weight:bold;margin-top:0px;font-size:18px;">--}}

                                {{--</form>--}}
                            {{--</div>--}}
                            <!-- --修改头像-- -->
                            <div class="mp" id="mp">
                                <div class="mp-tit">
                                    <h2>
                                        请选择头像
                                    </h2>
                                </div>
                                <div class="mp-form">
                                    <form method="post" action="{{ url('client/user/updateAvatar') }}" enctype="multipart/form-data">
                                        {{csrf_field()}}
                                        <div class="mp-choose">
                                            <input type="file" name="avatar" id="doc" multiple="multiple" onchange="PreviewImage(this)" value="">
                                        </div>
                                        <div class="mp-photo" id="imgPreview">
                                            <img src="/productImg/{{ $data['avatar'] }}" style="width:150px; height:150px;margin:50px;margin-left:0px;" class="img-thumbnail"/>
                                        </div>
                                        <script>
                                            function PreviewImage(imgFile)
                                            {
                                                var filextension=imgFile.value.substring(imgFile.value.lastIndexOf("."),imgFile.value.length);
                                                filextension=filextension.toLowerCase();
                                                if ((filextension!='.jpg')&&(filextension!='.gif')&&(filextension!='.jpeg')&&(filextension!='.png')&&(filextension!='.bmp'))
                                                {
                                                    alert("对不起，系统仅支持标准格式的照片，请您调整格式后重新上传，谢谢 !");
                                                    imgFile.focus();
                                                }
                                                else
                                                {
                                                    var path;
                                                    if(document.all)//IE
                                                    {
                                                        imgFile.select();
                                                        path = document.selection.createRange().text;
                                                        document.getElementById("imgPreview").innerHTML="";
                                                        document.getElementById("imgPreview").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果
                                                    }
                                                    else//FF
                                                    {
                                                        path=window.URL.createObjectURL(imgFile.files[0]);// FF 7.0以上
                                                        document.getElementById("imgPreview").innerHTML = "<img id='img1' width='150px' height='150px' src='"+path+"'/>";
                                                    }
                                                }
                                            }
                                        </script>
                                        <div style="width:100%;height:200px;float:left;"></div>
                                        <input type="submit" class="btn btn-success" name="sub"
                                               style="width:120px;font-weight:bold;font-size:18px;" value="提&nbsp;&nbsp;交">
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </center>
    </div>
    <script type="text/javascript" src="{{ asset('client/js/laydate.js') }}"></script>
    <!-- --账户设置 end-- -->
@stop